package newHomework.day11;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

/**
 * 生成10个0-100之间的不重复的随机数,并输出
 * @author pansheng
 *
 */
public class Test03 {
    public static void main(String[] args) {
        List<Integer> list  = new LinkedList<>();
        Random random = new Random();
        for (int i = 0;i<100;i++){
            if (list.size()<10){
                int j = random.nextInt(20);
                if (list.contains(j)){
                    continue;
                }
                list.add(j);
                if (list.size()>=10){
                    break;
                }
            }


        }
        System.out.println(list);
    }
}
